<html>
	<!--页面属性-->
	<head>
		<meta charset='utf-8'>
		<title>测试</title>
		
		<!--CSS选择器-->
		<style>
			
			*{
				margin:2px;
				padding:5px;
			}
			
			p{
				color:green;
				font-size:20px;
			}
			ol{
				color:red;
				font-size:25px;
			}
			
			.cpurple{
				color:purple;
				font-size:30px;
			}
			
			#h1_title{
				color:red;
				font-size:30;
			}
			
		</style>
	</head>
	
	<!--页面内容-->
	<body>
		<h1 id='h1_title'>你好</h1>
		<h2 class='cpurple'>再见</h2>
		
		<p>
			这是一个段落.<br/>一段话......
		</p>
		段落与换行是不一样的。<br/>
		
		<img src='./JsonRPC.jpg' width="300px" height="150px">	<br/>

		<a href='https://www.qq.com'>这是一个链接，可跳转</a> <br/>
		
		<ul>
			<li>ul/li是无序列表</li>
		</ul>
		
		<ol>
			<li>ol/li是有序列表</li>
		</ol>
		
		<dl>
			<dt>dl/dt是小标题</dt>
			<dd>dl/dd是小标题的描述<dd>
		</dl>
		
		<!--表单-->
		<form action='http://47.109.23.128:8888/login' method='post'>
			<input type='text' id='username' name='username'>
			<input type='password' id='password' name='password'>
			<input type='submit' name='submit' value="提交">
		</form>
		
		<button onclick="test()">按钮</button>
	</body>
	
	<script 
		src="https://cdn.staticfile.net/jquery/1.10.2/jquery.min.js">
	</script>
	
	<script>
		var ws=new WebSocket("ws://47.109.23.128:8888/login/ws");
		ws.onopen=function()
		{
			alert("ws 握手成功");
		}
		ws.onerror=function()
		{
			alert("ws 通信错误");
		}
		ws.onclose=function()
		{
			alert("ws 连接断开");
		}
		ws.onmessage=function(evt)
		{
			//alert(evt.data);
			var h1=document.getElementById("h1_title");
			//alert(h1.innerHTML);
			alert(evt.data);
			h1.innerHTML=evt.data;
		}
	
		function test()
		{
			ws.send(document.getElementById("username").value);
			document.getElementById("username").value="";
			//alert("你好！");
			//var h1=document.getElementById("h1_title");
			//alert(h1.innerHTML);
			//h1.innerHTML="大家好";
			
			//var input=document.getElementById("username");
			//alert(input.value);
			//input.value="";
			/*
			var login_info={
				username:document.getElementById("username").value,
				password:document.getElementById("password").value
			}
			$.ajax({
				type:"post",
				url:"http://47.109.23.128:8888/login",
				data:JSON.stringify(login_info),
				success:function(res,statu,xhr)
				{
					alert("res");
				},
				error:function(xhr)
				{
					alert(JSON.stringify(xhr));
				}
			});
			*/
			
			
		}
	</script>


</html>